﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Pointandclick.Objects
{
    class Player
    {
        Texture2D image;
        Point position;
        Inventory inventory;

        /// <summary>
        /// Initializes instance of Player class with empty inventory and desired image and position
        /// </summary>
        /// <param name="image">Player image</param>
        /// <param name="position">Player position</param>
        public Player(Texture2D image, Point position)
        {
            this.image = image;
            this.position = position;
            inventory = new Inventory();
        }

        /// <summary>
        /// Adds item to the inventory
        /// </summary>
        /// <param name="item"></param>
        public void Pickup(string key,Texture2D image)
        {
            inventory.Add(image,key);
        }

        public void Update(List<Trigger> triggerList, MouseState mouse)
        {
            inventory.Update(mouse,triggerList);
        }

        public void Draw(SpriteBatch spriteBatch, Color color)
        {
            spriteBatch.Draw(image, new Vector2(position.X,position.Y), color);

            // Draws the inventory
            inventory.Draw(spriteBatch, color);
        }

    }
}
